package com.samehope.ar.service.impl;

import com.samehope.ar.entity.TaskRoute;
import com.samehope.ar.mapper.TaskRouteMapper;
import com.samehope.ar.service.ITaskRouteService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.samehope.ar.util.SessionUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 巡检路线快照 服务实现类
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
@Service
public class TaskRouteServiceImpl extends ServiceImpl<TaskRouteMapper, TaskRoute> implements ITaskRouteService {

    /**
     * 生成线路快照信息
     */
    @Override
    public void insertAll(){
        this.baseMapper.insertAll();
    }

    /**
     * 生成线路快照信息
     */
    @Override
    public void insertByTask(Long taskId,  Long routeId){
        this.baseMapper.insertByTask( taskId, routeId);
    }

    /**
     * 删除快照信息
     * @param taskTime
     */
    @Override
    public void delByTaskTime(String taskTime){
        this.baseMapper.delByTaskTime(taskTime);
    }

    /**
     * 删除未执行任务快照
     * @param planId
     */
    @Override
    public void delByUnFinishTask(Long planId){
        this.baseMapper.delByUnFinishTask(planId, SessionUtil.getUserId());
    }

    @Override
    public void delByTaskId(Long taskId){
        this.baseMapper.delByTaskId(taskId, SessionUtil.getUserId());
    }
}
